package cs235.java;

public abstract class PersonImpl implements Person, Comparable<PersonImpl> {

    private String id;
    private String name;

    public String getID() {
        return id;
    }

    public void setID(String id) {
        if (id == null) {
            throw new IllegalArgumentException("ID cannot be null");
        }
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        if (name == null) {
            throw new IllegalArgumentException("Name cannot be null");
        }
        this.name = name;
    }

    public int compareTo(PersonImpl otherPerson) {
        return id.compareTo(otherPerson.id);
    }

    public boolean equals(Object otherObject) {
        if (otherObject instanceof PersonImpl) {
            if (((PersonImpl) otherObject).getID().equals(getID())) {
                return true;
            }
        }
        return false;
    }
    
    public abstract String toString();

}
